// Ducks.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "LexicalAnalyzer.h"
#include "SyntacticAnalyzer.h"
#include "Performer.h"

DUCK_TYPE ChooseDuckType()
{
	string duckType;
	cout << "Enter duck type: QUACKVA, RED or RUBBER: ";
	cin >> duckType;

	if ( duckType == "QUACKVA")
	{
		return QUACKVA;
	}
	else if ( duckType == "RED")
	{
		return RED;
	}
	else if ( duckType == "RUBBER")
	{
		return RUBBER;
	}
	else
	{
		ChooseDuckType();
	}
}


int _tmain(int argc, _TCHAR* argv[])
{
	CLexicalAnalyzer lexAn;
	CSyntacticAnalyzer synAn;
	CPerformer perf;

	DUCK_TYPE duckType = ChooseDuckType();

	while ( true )
	{
		vector <string> tokens = lexAn.GetTokens();
		vector <treePtr> trees = synAn.GetTrees(tokens);
		perf.ExecuteCode(trees, duckType);
	}

	return 0;
}

